import { createStore } from 'vuex'
import createPersistedState from 'vuex-persistedstate';
export default createStore({
  state: {
    token: '',
    menus: [],
    current_route: ''
  },
  getters: {
  },
  mutations: {
    set_token(state, token){
      state.token = token
    },
    set_menus(state, menus){
      state.menus = menus
    },
    loginout(state){
      state.token = ''
      state.menus = []
    },
    set_current_route(state, route){
      state.current_route = route
    }
  },
  actions: {
  },
  modules: {
  },
  plugins: [createPersistedState({
    storage: window.localStorage, // 这里只用 localStorage

  })]
})
